package com.lcry.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ConfigClientController
 *
 * @author lcry
 * @date 2020/03/15 22:06
 */
@RestController
@RefreshScope //刷新配置生效
public class ConfigClientController {

    @Value("${server.port}")
    private String serverport;

    @Value("${config.info}")
    private String configInfo;

    //    直接获取配置文件
    @GetMapping("/configInfo")
    public String getConfigInfo() {
        return configInfo + "服务端口：" + serverport;
    }

}
